<?php
define('ROOT', dirname(__FILE__));

require(ROOT . "/PicThumb.class.php");

// 按比例生成缩略图
$param = array(
    'type' => 'fit',
    'width' => 330,
    'height' => 240,
    'handler' => 'gd'
);
$logfile = ROOT.'/PicThumb.log';
$source1 = ROOT.'/HA6433Y.jpg';
$dest1 = ROOT.'/HA6433Y_thumb.jpg';
$obj = new PicThumb($logfile);
$obj->set_config($param);
$flag = $obj->create_thumb($source1, $dest1);

if($flag){
    echo '<img src="'.basename($dest1).'">';
}else{
    echo 'create thumb fail';
}
